#include "ButtonWidgetRect.h"


ButtonWidgetRect::ButtonWidgetRect(void)
{
	m_width = 0;
	m_height = 0;
}


ButtonWidgetRect::~ButtonWidgetRect(void)
{
}

void ButtonWidgetRect::SendEvent(WidgetEvent evt)
{
	switch(evt.eventType)
	{
	case WIDGETEVENT_TOUCH:
		if(dlg_onClick != 0)
		{
			if(this->IsInside(evt.x, evt. y))
			{
				dlg_onClick();
			}
		}
		break;
	}
}

bool ButtonWidgetRect::IsInside(int x, int y)
{
	if( (x >= this->GetX() && x <= this->GetX() + GetWidth())  &&  (y >= y && y <= GetY() + GetHeight()))
		return true;
	else
		return false;
}